package com.witte.serviceImp;

import com.witte.dao.AchievementMapper;
import com.witte.entity.Achievement;
import com.witte.entity.Product;
import com.witte.service.AchievementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class AchievementServiceImp implements AchievementService {
    @Autowired(required=false)
    AchievementMapper achievementMapper;
    @Override
    public Achievement getListByProductName(String name) {
        Achievement achievement = achievementMapper.selectByPrimaryKey(name);
        return achievement;
    }
    
    
    public Map<String ,List<Object>> getMapByProductName(String name){
    	List<Object> xList = new ArrayList<Object>();
    	List<Object> yList = new ArrayList<Object>();
    	Achievement achievement = achievementMapper.selectByPrimaryKey(name);
    	//yList.add(achievement.getProductname());
    	yList.add(achievement.getFirstQuarter());
    	yList.add(achievement.getSecondQuarter());
    	yList.add(achievement.getThirdQuarter());
    	yList.add(achievement.getForthQuarter());
    	
    	//xList.add("productname");
    	xList.add("第一季度");
    	xList.add("第二季度");
    	xList.add("第三季度");
    	xList.add("第四季度");
    	
    	Map<String ,List<Object>> ret = new HashMap<>();
    	
    	ret.put("x", xList);
    	ret.put("y", yList);
		return ret;	
    }
}
